<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Insert title here</title>
</head>
<script type="text/javascript" src="/js/jquery-1.8.2.min.js"></script>
<script>
    function del(id) {
        $.ajax({
            url:"del.do",
            type:"post",
            data:{"id":id},
            dataType:"json",
            success:function (obj){
                if(obj>0){
                    location="list.do";
                }
            }
        })
    }

</script>
<body>
    <table>
        <tr>
            <th>编号</th>
            <th>用户名</th>
            <th>密码</th>
            <th>图片</th>
            <th>
                <a href="toadd.do">添加</a>

            </th>
        </tr>
        <c:forEach items="${list}" var="u">
            <tr>
                <th>${u.id}</th>
                <th>${u.username}</th>
                <th>${u.password}</th>
                <th>
                   <a href="down.do?fileName=${u.pic}"> <img src="${u.pic}" alt="无法展示" width="250px"></a>
                </th>
                <td>
                    <input type="button" value="删除" onclick="del(${u.id})" >

                </td>
            </tr>
        </c:forEach>
    </table>


</body>
</html>